package com.bins.rabbitmq.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitmqPubSubConfig {

	@Bean
	public Queue fanout1Queue() {
	    return new Queue("fanout1_queue");
	}
	@Bean
	public Queue fanout2Queue() {
	    return new Queue("fanout2_queue");
	}

	@Bean
	public FanoutExchange fanoutExchange() {
	    return new FanoutExchange("fanout_exchange");
	}

	@Bean
	public Binding bindingExchange1() {
	    return BindingBuilder.bind(fanout1Queue()).to(fanoutExchange());
	}
	
	@Bean
	public Binding bindingExchange2() {
	    return BindingBuilder.bind(fanout2Queue()).to(fanoutExchange());
	}
}